package com.baidu.cmsService.dao;

import com.baidu.cmsCommes.pojo.UserRole;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: BSS
 * @create: 2020/6/18/16:49
 */
@Mapper
public interface UserRoleDao {

    @Insert("insert into t_user_role(id,r_id,u_id)value(#{id},#{rId},#{uid})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    Integer save(@Param("id") Integer id,@Param("rId") Integer rId,@Param("uid") Integer uid);

    @Select("select * from t_user_role where u_id=#{id}")
    @ResultType(UserRole.class)
    List<UserRole> selectByUid(@Param("id") Integer id);

    @Delete("delete from t_user_role where u_id=#{uid}")
    Integer deleteRoleByUid(@Param("uid") Integer uid);

    @Delete("delete from t_user_role where r_id=#{rid}")
    Integer deleteRoleByRid(@Param("rid") Integer rid);
}
